#include"server.h"


void test_db()
{
     class users_tables ut;
    Json::Value user;
    user["username"]="lilizhi";
    user["password"]="147258Ll!";
    // ut.insert(user);
    // std::string s="liuzz";
    // ut.select_by_name(s,user);
    
    // std::string s="select * from users where username='lili'";

    // MYSQL *mysql=ut._mysql;
    // mysql_util::mysql_exec(mysql,s);;
    // MYSQL_RES *res=mysql_store_result(mysql);
    // ut.select_by_id(100,user);
    // INF_Log("%s",user["username"].asString().c_str());
    // INF_Log("%s",user["id"].asString().c_str());
    // INF_Log("%s",user["total_count"].asString().c_str());

    ut.login(user);
    // INF_Log("%s",user["username"].asString().c_str());
    // INF_Log("%s",user["id"].asString().c_str());
    // INF_Log("%s",user["total_count"].asString().c_str());
}
void online_test()
{
    online_manager om;
    wsserver_t::connection_ptr conn;
    uint64_t uid = 2;
    om.enter_game_room(uid, conn);
    if (om.is_in_game_room(uid)) {
        DBG_Log("IN GAME HALL");
    }else {
        DBG_Log("NOT IN GAME HALL");
    }
    om.exit_game_room(uid);
    if (om.is_in_game_room(uid)) {
        DBG_Log("IN GAME HALL");
    }else {
        DBG_Log("NOT IN GAME HALL");
    }

}
void test_room()
{
    //uint64_t room_id, users_tables *tb_user, online_manager *online_user
    users_tables ut;
    online_manager online_user;
    class room r(uint64_t(1),&ut,&online_user);
    
}

void test_mather()
{
   
    users_tables ut;
    online_manager online_user;
    room_manager rm(&ut,&online_user);
    class matcher m(&rm,&ut,&online_user);
}

int main()
{
   gobang_server server;
   server.start(8888);
}